
integer attachment = TRUE;
integer relaychannel = -1812221819;
string cmdname;
key victim;
list gMenu=[];
list statesMenu=[0,0,0,0,0,0,0,0,0,0];
list gAvatarAllow;
integer gMenuLink =1337;
integer gDemon =1338;
key ToucherID;
integer channel_dialog;
integer listen_id;
integer listen_id2;
integer channel_Update=1336;
string msg ="Update to 0.11 Beta";
list sideMenu=[" ","Back"," "];
integer pin = 15385;


makeMenu()
{
	gMenu=[];
	gMenu+=sideMenu;
	gMenu+="Start";
	channel_dialog = ( -1 * (integer)("0x"+llGetSubString((string)llGetKey(),-5,-1)) );
	llDialog(ToucherID, msg,gMenu, channel_dialog);
	listen_id = llListen( channel_dialog, "", NULL_KEY, "");

	
}

default {
    state_entry() 
    {
    	    
    }
    
    listen(integer channel, string name, key id, string message)
    {
		if(channel==channel_dialog)
		{
    		llListenRemove(listen_id);
    		if(message=="Start")
    		{
    			
    			llSetRemoteScriptAccessPin(pin);
				llSay(channel_Update,llKey2Name(llGetOwner()));		
				listen_id2 = llListen( channel_Update, "", llGetOwner(), "");
    		}
			if(message=="Back")llMessageLinked(LINK_THIS, gMenuLink, "DV_BASIC", ToucherID);
		}
		if(channel==channel_Update)
		{
			if(message==llKey2Name(llGetOwner()))
			{
				llOwnerSay("Update Done");
				llResetScript();
			}
		}
		
    }
    
    on_rez(integer on)
    {
    
    }
    
    link_message(integer sender, integer num, string str, key id)
  	{
  		
  		if(num == gMenuLink)
  		{
  			if(str==llGetScriptName())
  			{
  				ToucherID=id;
  				makeMenu();
  				llMessageLinked(LINK_THIS, gDemon, llGetScriptName(), NULL_KEY);
  				
  			}
  		}
  		if(num ==gDemon)
  		{
  			if(str =="attachment")attachment=TRUE;
  			else if(str =="device")attachment=FALSE;
  			else if(str!=llGetScriptName())
  			{
				llListenRemove(listen_id);
  			}
  		}
  	}
  	timer()
    {

    }
}
